import {
    createRouter,
    createWebHistory,
    createWebHashHistory
} from 'vue-router';
import {
    defineAsyncComponent
} from 'vue';
const app = defineAsyncComponent(() => import('@/views/app.vue'))
const input = defineAsyncComponent(() => import('@/views/input.vue'))
const gpt = defineAsyncComponent(() => import('@/views/gpt.vue'))
const info = defineAsyncComponent(() => import('@/views/Info.vue'))
const cos = defineAsyncComponent(() => import('@/views/cos.vue'))
const f = defineAsyncComponent(() => import('@/views/fileview.vue'))
const s = defineAsyncComponent(() => import('@/views/Search.vue'))
const v = defineAsyncComponent(() => import('@/views/view.vue'))
const w = defineAsyncComponent(() => import('@/views/weather.vue'))
const map = defineAsyncComponent(() => import('@/views/map.vue'))
const date = defineAsyncComponent(() => import('@/views/date.vue'))
// 定义路由
const routes = [{
        path: '/',
        redirect: '/app' // 将根路径重定向到 '/home'
    },
    {
        path: '/app',
        name: 'App',
        component: app
    },
    {
        path: '/info',
        component:info
    },
    {
        path: '/cos',
        component: cos
    },
    {
        path: '/f',
        component:f
    },
    {
        path: '/t',
        component: input,
        meta: {
            noCache: true
        }
    },
    {
        path: '/s',
        component:s
    },
    {
        path: '/v',
        component: v
    },
    {
        path: '/gpt',
        component: gpt
    },
    {
        path: '/w',
        component: w
    },
    {
        path: '/map',
        component: map
    },
    {
        path: '/date',
        component: date
    }
    // ... 其他路由
];

const router = createRouter({
    // createWebHashHistory()是使用hash模式路由
    // createWebHistory()是使用history模式路由
    history: createWebHashHistory(),
    routes
});

export default router;